package com.gitee.neuray.security.gateway.strategy;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * @author: zhhongyu
 * @description: 网关权限自动注册类
 * @since: Create in 9:59 2020/3/27
 */
@Configuration
@ConditionalOnProperty(prefix = "zuul.permission", name = "enabled", havingValue = "true")
public class ZuulAutoConfiguration {

    @ConditionalOnProperty(prefix = "zuul.permission", name = "blockingtype", havingValue = "button")
    public class ButtonCheck{
        @Bean
        public AbstratePermissionStrategy getAbstratePermission(){
            return new ButtonPermission();
        }
    }
    @ConditionalOnProperty(prefix = "zuul.permission", name = "blockingtype", havingValue = "uri")
    public class UriCheck{
        @Bean
        public AbstratePermissionStrategy getAbstratePermission(){
            return new UriPermission();
        }
    }
}
